

#ifndef __MapEditor_h_
#define __MapEditor_h_


//#include "BaseApplication.h"
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#include "../res/resource.h"
#endif
#include <CEGUI/CEGUISystem.h>
#include <Ogre.h>
#include <OgreRoot.h>
#include <OIS/OIS.h>
#include "OgreCEGUIRenderer.h"
#include "OgreCEGUIResourceProvider.h"
#include "Constants.h"
#include "SceneObject.h"
#include "OgreApp.h"
#include "Tools/Tool.h"
#include "Tools/ToolMoveCamera.h"
#include "EventHandler.h"


class MapEditor : OgreApp
{
	public:
		//MapEditor();
		void start();
		virtual ~MapEditor(void);
		void createScene(void);
		void toolEnded();
		void addModel(CEGUI::String path); //done!
		void startMovingObject();
		void startScalingObject();  //done!
		void startRotatingObject();  //done!
		void startDuplicatingObject();
		void startRemovingObject();  //done!
		void quit();
		
		static MapEditor* instance(){

			static MapEditor mapEditor;

			return & mapEditor;
		}



	protected:
		void createFrameListener();
		
	private:
		
		Ogre::RaySceneQuery* mRaySceneQuery;
		Ogre::Camera *mCamera;
		Ogre::SceneManager *mSceneMgr;   // The current SceneManager
		Ogre::SceneNode *mCamNode;   // The SceneNode the camera is currently attached to

		Tool *noTool;
		ToolMoveCamera *cameraTool;
		BufferedInputHandler *mListener;

		static MapEditor *mapEditor;


		void setupCEGUI();
		void createTerrain();
		void setInterfaceActivated(bool b);

		MapEditor();

};


#endif // #ifndef __MapEditor_h_